pkg_name=ncurses
version=5.9
rollup=20140308
build_dir=$builds_dir_root/$pkg_name-$version
src_dir=$src_dir_root/$pkg_name-$version
url0=http://ftpmirror.gnu.org/$pkg_name/$pkg_name-$version.tar.gz
#this is the Rollup patches
url1=ftp://invisible-island.net/$pkg_name/$version/$pkg_name-$version-$rollup-patch.sh.bz2

cd "$src_dir_root"
rm -Rf "$pkg_name-$version"
tar zxf "$pkg_name-$version.tar.gz"

#apply the latest rollup patch
cp "$src_dir_root/$pkg_name-$version-$rollup-patch.sh.bz2" "$src_dir"
cd "$src_dir"
bzip2 -d ./$pkg_name-$version-$rollup-patch.sh.bz2
chmod +x ./$pkg_name-$version-$rollup-patch.sh
./$pkg_name-$version-$rollup-patch.sh

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

export CFLAGS=-O0
"$src_dir/configure"		\
	--prefix=		\
	--without-ada		\
	--without-cxx		\
	--without-cxx-binding	\
	--enable-db-install	\
	--without-manpages	\
	--with-progs		\
	--without-tests		\
	--without-curses-h	\
	--with-pkg-config	\
	--enable-pc-files	\
	--disable-mixed-case	\
	--without-libtool	\
	--with-shared		\
	--without-normal	\
	--without-debug		\
	--without-profile	\
	--with-termlib		\
	--with-ticlib		\
	--without-gpm		\
	--disable-rpath		\
	--disable-relink	\
	--disable-rpath-hack	\
	--enable-overwrite	\
	--disable-termcap	\
	--enable-symlinks	\
	--enable-widec		\
	--disable-tic-depends	\
	--enable-ext-funcs	\
	--enable-sp-funcs	\
	--enable-ext-colors	\
	--disable-ext-mouse	\
	--without-develop	\
	--enable-colorfgbg
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

install_dirs "$builders_dir_root/$pkg_name/runtime.dirs"
install_files "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir"
install_links "$builders_dir_root/$pkg_name/runtime.links"
install_dirs "$builders_dir_root/$pkg_name/devel.dirs"
install_files "$builders_dir_root/$pkg_name/devel.files" "$install_tmp_dir"
install_links "$builders_dir_root/$pkg_name/devel.links"
elf_strip "$builders_dir_root/$pkg_name/elf-strip"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
